package com.it.rocketmp.consumer;

import com.it.rocketmp.producer.msg.Msg;
import com.it.rocketmp.producer.msg.Topic;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
@RocketMQMessageListener(
        topic = Msg.topic,
        consumerGroup = "demo01-A-consumer-group-" + Topic.topic
)
public class consumer implements RocketMQListener<Msg>{
    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void onMessage(Msg Msg) {
        logger.info("[onMessage][线程编号:{} 消息内容：{}]", Thread.currentThread().getId(), Msg.toString());
    }
}


